package com.fowo.api.sys.acm;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 异步控制器方法切面
 * @author yl_ls
 */
@Component
@Aspect
public class AsyncControllerMethodAop {

    @Resource
    private AsyncControllerMethodExecutor executor;

    @Pointcut("execution(* com.fowo.api..controller.*Controller.*(..)) && @annotation(AsyncControllerMethod)")
    public void pointcut() {  }

    @Around(value = "pointcut()")
    public Object around(ProceedingJoinPoint joinPoint) {
        return executor.startTask(joinPoint);
    }
}
